<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="db2.*" %>
<%@ page import="beans2.Patient" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="service2.Patientquene" %>
<%@ page import="service2.SignService" %>
<%--
在index.jsp使用session保存了医生的id和医生的密码


--%>
<html>
<head>
    <title>医生端</title>
    <link rel="icon" href="../image/find.jpg" sizes="16x16">

    <meta charset="UTF-8">
    <link href="../css/new_model.css" type="text/css" rel="stylesheet">
    <script src="../js/ac2.js" type="text/javascript"></script>
    <style>
        td{
            width: 150px;
            height:40px;
        }
        td:nth-child(2),td:nth-child(4),td:nth-child(5){
            width: 80px;
            height:40px;
        }
        td:nth-child(7){
            width: 250px;
            height:40px;
            /*background-color: pink;*/
        }
        tr:nth-child(2n) {
            background-color: #f2f2f2;
        }
        #head{
            background-color: white;
            font-weight: bold;
            text-align: center;
        }
        #content-show{
            width: 80%;
            float: left;
            height: 94%;
        }
        #right-top{
            background-color: #e6ffe9;
            margin-top: 5% ;
            float: left;
            width: 18%;
            height: 30%;
            box-shadow: 0 6px 32px -7px rgba(29,102,189,.16);
        }
        #right-bo{
            background-color: #e6ffe9;
            margin-top: 5% ;
            float: left;
            width: 18%;
            height: 30%;
            box-shadow: 0 6px 32px -7px rgba(29,102,189,.16);
        }
        #top_lab{
            position: relative;
            background-color:  #e6ffe9;
            height: 6%;
            width: 100%;
            overflow: hidden;
        }
        #search{
            margin-top:8px;
            margin-right:8px;
            border:none;
            height: 30px;
            border-radius: 8px;
            float: right;
        }
        #search-img{
            border-radius: 16px;
            float: right;
            margin-top:8px;
            margin-right:10%;
        }
        #content{
            background-color: #e6ffef;
        }

    </style>
</head>
<body>
<div id="menu" style="user-select:none;">
    <button class="closebtn"   onclick="closeNav()"><strong>&#9776;</strong> </button>
    <ul class="list">
        <li class="item" value="1" onclick="show(0)">
            <div class="parentNav" >
                <strong> &nbsp;叫号管理</strong>
            </div>
            <ul class="two">
                <li><a href="Callpatient.jsp">&nbsp; &nbsp;叫号管理</a></li>
                <li><a href="Add_patient.jsp">&nbsp; &nbsp;添加患者</a></li>
            </ul>
        </li>
        <li class="item" value="1" onclick="show(1)">
            <div class="parentNav" >
                <strong> &nbsp;过号处理</strong>
            </div>
            <ul class="two">
                <li><a href="Overnum.jsp">&nbsp; &nbsp; 过号处理</a></li>
            </ul>
        </li>
        <li class="item" value="1" onclick="show(2)">
            <div class="parentNav" >
                <strong>&nbsp;个人信息管理</strong>
            </div>
            <ul class="two">
                <li><a href="doc_inform.jsp">&nbsp; &nbsp;账号密码管理</a></li>
            </ul>
        </li>
    </ul>
</div>
<div id="content">
    <div id="top_lab">过号病人
        <button class="menu_button" onclick="openNav()"><strong>&#9776;</strong> </button>
<%--        <img id="search-img" src="find3.png" width="32" height="32"><input id="search" type="text" id="search"  >--%>
    </div>
    <div id="content-show">
        <table border="0px"  cellspacing="5px">
            <tr id="head">
                <td>序号</td>
                <td>姓名</td>
                <td>就诊号</td>
                <td>年龄</td>
                <td>性别</td>
                <td>状态</td>
                <td>操作</td>
            </tr>
            <tr align="center">
          <%
          SignService signService=new SignService();
          ArrayList<Patient>list=signService.PatientALate(((String)session.getAttribute("id")));
          int i=1;
          if(list==null){
              System.out.println("LIST:ERROR");
          }
          else
          for(Patient patient:list){
        %>
                <%--
                修改数据库
                1.忘记添加session里面医生id
                2.忘记判断是否是当天 还未解决
                --%>
            <tr align="center">
                <td class="state<%=i%>"><%=patient.getOrder()%></td>
                <td class="state<%=i%>"><%=patient.getName()%></td>
                <td class="state<%=i%>"><%=patient.getIdnumber()%></td>
                <%
                    Calendar c = Calendar.getInstance();
                    c.setTime(patient.getBirthday());
                    int y =Calendar.getInstance().get(Calendar.YEAR)-c.get(Calendar.YEAR);%>
                <td class="state<%=i%>"><%=y%></td>
                <td class="state<%=i%>"><%=patient.getSex()%></td>
                <td class="state<%=i%>"><%="等待就诊"%></td>
                <td class="state<%=i%>">
                    <button onclick="Callpatient(<%=i%>)">叫号</button>
                    <button onclick="Callpatient(<%=i++%>)">重呼</button>
                    <button ><a href="uppa?Account=<%=patient.getAccount()%>&indid=<%=patient.getIndid()%>">完成就诊</a></button>
                </td>
            </tr>
            <%
                    }
            %>
        </table>
    </div>
    <div id="right-top">
        <div>
            今日总预约量<%=signService.RecordSum((String)session.getAttribute("id"))%>
        </div>
        <div>

            今日已就诊人数<%=signService.RecordTreatSum((String)session.getAttribute("id"))%>
        </div>
    </div>
    <div id="right-bo">
        <div>
            今天又是辛勤的一天
        </div>
    </div>
</div>

</body>
<script>
    document.getElementById("search").oninput=function () {
        console.log(this.value);
    };
    function Callpatient(index){
        var a="state"+index;
        var tdlist=document.getElementsByClassName(a);
        tdlist[5].innerHTML="<span style='color: red;'>就诊中</span>";
        alert("请"+tdlist[1].innerText+"先生前来就诊");
    }

</script>
</html>

<%--
drop table YY_patient;
drop table YY_admin;
drop table YY_doctor;
drop table YY_ks;
drop table YY_mz;
drop table YY_doctor_scheduling;
drop table YY_indent;
drop table YY_application;
drop table YY_sign;
select * from YY_patient;
select * from YY_admin;
select * from YY_doctor;
select * from YY_ks;
select * from YY_mz;
select * from YY_DOCTOR_SCHEDULING;
select * from YY_indent;
select * from YY_application;
select * from YY_sign;

--%>